package com.mrzhiyi.demo.sb.common.resp;

public enum RespCode{
    /**
     * 1. 以下错误码的定义，需要提前与前端沟通
     * <p>
     * 2. 错误码按模块进行错误码规划
     */
    SUCCESS(0,"操作成功！"),
    ERROR(-1,"操作失败！"),
    /* 参数错误：10001-19999 */
    PARAM_IS_INVALID(10001,"参数无效"),
    PARAM_IS_BLANK(10002,"参数为空"),
    PARAM_TYPE_BIND_ERROR(10003,"参数类型错误"),
    PARAM_NOT_COMPLETE(10004,"参数缺失"),
    /* 用户错误：20001-29999*/
    ACCOUNT_TOKEN_NOT_EXIST(20001,"用户未登录"),
    ACCOUNT_TOKEN_INVALID(20002,"token无效"),
    ACCOUNT_LOGIN_ERROR(20003,"账号不存在或密码错误"),
    ACCOUNT_FORBIDDEN(20004,"账号已被禁用"),
    ACCOUNT_NOT_EXIST(20005,"用户名不存在"),
    ACCOUNT_HAS_EXISTED(20006,"用户名已存在"),
    ACCOUNT_NOT_EMPTY(20007,"用户名不能为空"),
    /* 业务错误：30001-39999 */
    SPECIFIED_QUESTIONED_ERROR(30001,"业务逻辑出现问题"),
    SPECIFIED_QUESTIONED_ADMIN_FORBID_DEL(30002,"管理员不能删除"),
    SPECIFIED_QUESTIONED_CONFIG_NOT_EXIST(30003,"配置信息不存在"),
    SPECIFIED_QUESTIONED_CONFIG_ID_NOT_NULL(30004,"配置信息的id不能为空"),
    SPECIFIED_QUESTIONED_CAROUSEL_NOT_EXIST(30005,"轮播图不存在"),
    SPECIFIED_QUESTIONED_CATEGORY_NOT_EXIST(30006,"栏目不存在"),
    SPECIFIED_QUESTIONED_ARTICLE_NOT_EXIST(30007,"咨询不存在"),
    SPECIFIED_QUESTIONED_COMMENT_NOT_EXIST(30008,"评论不存在"),
    /* 系统错误：40001-49999 */
    SYSTEM_INNER_ERROR(40001,"系统内部错误，请稍后重试"),
    /* 数据错误：50001-599999 */
    DATA_NONE(50001,"数据未找到"),
    DATA_WRONG(50002,"数据错误"),
    DATA_EXISTED(50003,"数据已存在"),
    /* 接口错误：60001-69999 */
    INTERFACE_INNER_INVOKE_ERROR(60001,"内部系统接口调用异常"),
    INTERFACE_OUTER_INVOKE_ERROR(60002,"外部系统接口调用异常"),
    INTERFACE_FORBID_VISIT(60003,"该接口禁止访问"),
    INTERFACE_ADDRESS_INVALID(60004,"接口地址无效"),
    INTERFACE_REQUEST_TIMEOUT(60005,"接口请求超时"),
    /* 权限错误：70001-79999 */
    PERMISSION_NOT_ADMIN(70001,"当前用户不是管理员"),
    PERMISSION_NO_ACCESS(70002,"无访问权限");
    private final Integer code;
    private final String msg;

    RespCode(Integer code,String msg){
        this.code=code;
        this.msg=msg;
    }

    public Integer code(){
        return code;
    }

    public String msg(){
        return msg;
    }
}
